Feat: Support :var Input to org babel code blocks #4
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
for testing i used the following blocks
#+NAME: ob-dart-variables-result-output
#+BEGIN_SRC dart :var projectname="dart" :var input="why" :results output
print("Project Name: $projectname");
print("Input: $input");
#+END_SRC
#+NAME: ob-dart-variables-result-value
#+BEGIN_SRC dart :var projectname="dart" :var input="why" :results value
return "Project Name: $projectname, Input: $input";
#+END_SRC
#+NAME: dart-body-main
#+begin_src dart :results output
/// Complete Dart code snippet can be wrapped.
main(List args) {
var listMax = [10,20,30].reduce(max);
print ('WE HAVE MAIN');
print ('In output mode, all printed lines show in result');
print ('List max printed = ' + listMax.toString());
return ('Results: value!! List from MAIN');
}
main([]);
#+end_src
#+RESULTS: dart-body-main
: WE HAVE MAIN
: In output mode, all printed lines show in result
: List max printed = 30
#+NAME: ob-dart-function
#+begin_src dart :var number=4
square(x) {
return x * x;
}
return square(number);
#+end_src
#+RESULTS: ob-dart-function
: 16
#+NAME: ob-dart-print-var-input
#+begin_src dart :var input="why" :results output
// Access the variable using the
vars
objectvar message = "$input";
// Use the input variable
print(message);
#+end_src